<?php

class Kd_Web {

    private static $_router = NULL;
    private static $_filter = NULL;
    private static $_handler = NULL;
    private static $_identity = NULL;
    private static $_request = NULL;
    private static $_response = NULL;
    private static $_session = NULL;
    private static $_variables = NULL;
    private static $_page = NULL;
    private static $_messager = NULL;
    private static $_history = NULL;
    
    public static function getFilter(){
        if(is_null(self::$_filter)){
            $class = Kd_Web_Config::getFilterClass();
            self::$_filter = new $class();
        }
        return self::$_filter;
    }

    public static function getRouter(){
        if(is_null(self::$_router)){
            $class = Kd_Web_Config::getRouterClass();
            self::$_router = new $class();
        }
        return self::$_router;
    }

    public static function getHandler(){
        if(is_null(self::$_handler)){
            $class = Kd_Web_Config::getHandlerClass();
            self::$_handler = new $class();
        }
        return self::$_handler;
    }

    public static function getIdentity(){
        if(is_null(self::$_identity)){
            $class = Kd_Web_Config::getIdentityClass();
            self::$_identity = new $class();
        }
        return self::$_identity;
    }

    public static function getRequest(){
        if(is_null(self::$_request)){
            $class = Kd_Web_Config::getRequestClass();
            self::$_request = new $class();
        }
        return self::$_request;
    }

    public static function getResponse(){
        if(is_null(self::$_response)){
            $class = Kd_Web_Config::getResponseClass();
            self::$_response = new $class();
        }
        return self::$_response;
    }

    public static function getSession(){
        if(is_null(self::$_session)){
            $class = Kd_Web_Config::getSessionClass();
            self::$_session = new $class();
        }
        return self::$_session;
    }

    public static function getVariables(){
        if(is_null(self::$_variables)){
            $class = Kd_Web_Config::getVariablesClass();
            self::$_variables = new $class();
        }
        return self::$_variables;
    }

    public static function getMessager(){
        if(is_null(self::$_messager)){
            $class = Kd_Web_Config::getMessagerClass();
            self::$_messager = new $class();
        }
        return self::$_messager;
    }

    public static function getHistory(){
        if(is_null(self::$_history)){
            $class = Kd_Web_Config::getHistoryClass();
            self::$_history = new $class();
        }
        return self::$_history;
    }

    public static function getPage(){
        if(is_null(self::$_page)){
            self::$_page = new Kd_Html_Page();
        }
        return self::$_page;
    }
}